-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial implementation of weapons predicting #217
base: master
Are you sure you want to change the base?
Conversation
SNMetamorph
commented
Sep 4, 2024
87399b0
to
65cc5fb
Compare
65cc5fb
to
1bb7aae
Compare
1bb7aae
to
b382e2a
Compare
b2a79bd
to
f995120
Compare
46752d2
to
8f987c2
Compare
077a372
to
0437a27
Compare
be753c1
to
b444f82
Compare
b444f82
to
4d71a40
Compare
c7c87b7
to
ef36c10
Compare
629472d
to
03c93f7
Compare
…ared between client and server
…s client & server
… predicting and without it
d056743
to
59595d2
Compare
{ | ||
// Don't clear global fields | ||
if (!m_global || !(pFields[i].flags & FTYPEDESC_GLOBAL)) | ||
memset(((char *)pBaseData + pFields[i].fieldOffset), 0, pFields[i].fieldSize * GetFieldSize(&pFields[i])); |
Check failure
Code scanning / CodeQL
Multiplication result converted to larger type High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 9 hours ago
To fix the problem, we need to ensure that the multiplication is performed using a larger integer type before the result is converted to size_t
. This can be achieved by casting one of the operands to size_t
before performing the multiplication. This way, the multiplication will be done in the size_t
type, which is large enough to hold the result without overflow.
Specifically, we will modify the line pFields[i].fieldSize * GetFieldSize(&pFields[i])
to cast one of the operands to size_t
before the multiplication. This change will be made in the file server/saverestore.cpp
on line 1085.
-
Copy modified line R1085
@@ -1084,3 +1084,3 @@ | ||
if (!m_global || !(pFields[i].flags & FTYPEDESC_GLOBAL)) | ||
memset(((char *)pBaseData + pFields[i].fieldOffset), 0, pFields[i].fieldSize * GetFieldSize(&pFields[i])); | ||
memset(((char *)pBaseData + pFields[i].fieldOffset), 0, static_cast<size_t>(pFields[i].fieldSize) * GetFieldSize(&pFields[i])); | ||
} |